<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>电影列表</title>
    <%- include common %>
</head>
<body>
    <%- include("head",{title:"movie",username})%>
    <div class="container container-fluid">
        <div class="row" >
            <h2 class="text-success">电影列表</h2>
        </div>
       <div class="row" style="margin-top: 20px;">
           <div class="col-md-12 col-sm-12 col-lg-12">
             <button class="btn btn-info" onclick = "location.href='/movie?year=1'">年份升序</button>
             <button class="btn btn-danger" onclick = "location.href='/movie?year=-1'">年份降序</button>
             <button class="btn btn-warning" onclick = "location.href='/movie?rating.average=1'">评分升序</button>
             <button class="btn btn-success" onclick = "location.href='/movie?rating.average=-1'">评分将序</button>
       </div>
    </div>
    <div class="row" style="margin-top: 20px;">
        <div class="col-md-4 col-sm-4 col-lg-4">
         <div style="display: flex;">
              <input type="text" id="keyword" class="form-control" placeholder="请输入关键字">
                <button class="btn btn-info" onclick="toSearch()">点击搜索</button>

         </div>
    </div>
</div>

        <div class="row" style="margin-top: 20px;">
            <%    result.forEach((item,i)=>{   %>
                <div class="col-md-3 col-sm-3 col-lg-3">
                 
                        <div class="thumbnail">
                            <img src="<%- item.images.large.replace(/img7/,'img3') %>" alt="" style="height:260px;width:100%" >
                            <div>
                                <h4 class="pull-right"> <%- item.year %>  </h4>
                                <h4 class="text-danger"> <%- item.title %>  </h4>
                                <p class="text-success">评分： <%- item.rating.average %></p>
                                <p class="text-primary">分类： <%- item.genres %></p>
                                <p class="text-primary">导演： <%- item.directors[0].name %></p>
                                <p class="text-primary">主演： <%- item.actors %></p>
                            </div>
                            <button onclick="location.href='/comment/index?mid=<%-item.id%>'" class="btn btn-primary" style="width:100%;">点击评论</button>
                        </div>
                  
                </div> 
        <%    })   %>
        </div>
    </div>

    <%- include foot %>
    <script>
        //模糊搜索函数
        function toSearch(){
            window.location.href='/movie?keyword='+ $("#keyword").val()
        }
    </script>
</body>
</html>